#include <tsubamegaeshi-base/soccerbotbehavior.h>
#include <iostream>
#include <sstream>
#include <cmath>

using namespace std;
using namespace boost;

SoccerbotBehavior::SoccerbotBehavior(Worldmodel::shared_ptr w, Action::shared_ptr a)
    : init_(false),
      parser_(w),
      world_(w),
      ach_(a)
{
}

string
SoccerbotBehavior::init()
{
    //return "(scene rsg/agent/soccerbot056.rsg)";
    ach_->clear();
    ach_->scene("rsg/agent/soccerbot056.rsg");
    return ach_->get_commands();
}

string
SoccerbotBehavior::think(const std::string& message)
{
    ach_->clear();

    if (!init_) {
        init_ = true;
        ach_->init(world_->teamname());
    } 

    parser_->parse(message);

    ach_->action();

    //std::cout << ach_->get_commands() << std::endl;
    return ach_->get_commands();
}
